import { BrowserRouter, Route, Routes } from "react-router-dom"
import { AuthRoute } from '@/components/AuthRoute'
import Login from "@/pages/Login"
import Layout from "@/pages/Layout"
import './App.css'
import Home from "./pages/Home"
import Article from "./pages/Artcle"
import Publish from "./pages/Publish"
import { HistoryRouter, history } from './utils/history'

function App () {
  return (
    <HistoryRouter history={history}>
      <div className="App">
        <Routes>
          <Route path="/" element={
            <AuthRoute>
              <Layout />
            </AuthRoute>
          }>
            {/* 二级路由默认页面 */}
            <Route index element={<Home />} />
            <Route path="article" element={<Article />} />
            <Route path="publish" element={<Publish />} />
          </Route>
          <Route path="/login" element={<Login />}></Route>
        </Routes>
      </div>
    </HistoryRouter>
  )
}

export default App
